package com.training.java.core.homework07.collections.laptop.pre15;

public class LaptopMutable {

	// Variables
	private String laptopName;
	private boolean powerOn;
	private double memory;
	private double diskCapacity;

	private double maxMemory = 4;
	private double maxDiskCapacity = 100;

	// Methods
	LaptopMutable(String laptopName) {
		this.powerOn = false; // instantiate with a default of false
		this.memory = maxMemory;
		this.diskCapacity = maxDiskCapacity;
		this.laptopName = laptopName;

		System.out.println("A Laptop object, " + this.laptopName
				+ " is instantiated with no power, memory = " + this.memory
				+ " GB" + " disk capacity = " + this.diskCapacity + " GB" + ".");
	}

	public void start() {
		if (this.powerOn == false) {
			setPowerOn(true);
		}
		System.out.println("laptop is started... .");
	}

	public void stop() {
		if (this.powerOn == true) {
			setPowerOn(false);
		}
		System.out.println("laptop is stoping ... stopped now.");
	}

	public void upgrade(double maxMemory, double maxDiskCapacity) {
		setMaxMemory(maxMemory);
		setMaxDiskCapacity(maxDiskCapacity);

		System.out.println("laptop has been upgraded to, memory = "
				+ this.maxMemory + " GB" + " disk capacity = "
				+ this.diskCapacity + " GB");
	}

	// Getters
	public boolean isPowerOn() {
		return this.powerOn;
	}

	public double getMemory() {
		return this.memory;
	}

	public double getDiskCapacity() {
		return this.diskCapacity;
	}

	public double getMaxMemory() {
		return this.maxMemory;
	}

	public double getMaxDiskCapacity() {
		return this.maxDiskCapacity;
	}

	public String getLaptopName() {
		return this.laptopName;
	}

	// Setters
	private void setPowerOn(boolean powerOn) {
		this.powerOn = powerOn;
	}

	private void setMaxMemory(double maxMemory) {
		this.maxMemory = maxMemory;
	}

	private void setMaxDiskCapacity(double maxDiskCapacity) {
		this.maxDiskCapacity = maxDiskCapacity;
	}

	private void setLaptopName(String laptopName) {
		this.laptopName = laptopName;
	}
}
